<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .yeye {
            width: 250px;
            height: 250px;
            background-color: yellowgreen;
        }

        .parent {
            width: 180px;
            height: 180px;
            background-color: palevioletred;
        }

        .child {
            width: 100px;
            height: 100px;
            background-color: sandybrown;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 1.表单修饰符 lazy trim number -->
        <!-- <h3>1.表单修饰符</h3> -->
        <!-- <div>val:{{ val }}</div> -->
        <!-- <input type="text" v-model.lazy.trim="val"> -->
        <!-- <input type="text" v-model.trim="val"> -->
        <!-- 2.鼠标按键修饰符  .left .right-->
        <!-- <button @click="_click(0)">点击事件</button>
        <button @click.left="_click(1)">点击事件.左键</button>
        <button @click.right="_click(2)">点击事件.右键</button> -->

        <!-- 3.v-bind 属性修饰符 camel(openDoor)  prop-->

        <!-- <input type="text" :name:'' :value:'' :index.prop="1"> -->

        <!-- 4.事件修饰符 -->
        <!-- 
            .prevent 阻止默认行为
            .stop  阻止事件传播
            .self  触发的目标元素是自己才执行
            .capture 实现事件(监听)
            .once  一次性事件
         -->

        <!--  .prevent 阻止默认行为 -->
        <button @contextmenu.prevent="yj">鼠标右击事件</button>
        <!-- .stop 阻止事件传播 -->
        <div class="yeye" @click="_yeye()">
            yeye
            <div class="parent" @click="_parent()">
                parent
                <div class="child" @click.stop="_child()">
                    child
                </div>
            </div>
        </div>
        <!-- .self 触发的目标元素是自己才执行 -->
        <div class="yeye" @click.self="_yeye()">
            yeye
            <div class="parent" @click="_parent()">
                parent
                <div class="child" @click="_child()">
                    child
                </div>
            </div>
        </div>

        <!-- .capture 实现事件（监听） -->
        <div class="yeye" @click.capture="_yeye()">
            yeye
            <div class="parent" @click.capture="_parent()">
                parent
                <div class="child" @click="_child()">
                    child
                </div>
            </div>
        </div>
        <!--  .once 一次性事件绑定 -->
        <button @click.once="_once()">once</button>

        <!-- 
                    键盘事件修饰符
                        .left 左键
                        .right 右键
                        .up 上键
                        .down 下键
                        .enter 回车
                        .13 键码
                  -->
        <input type="text" @keyup.up.13="_keyup">
    </div>

    <script>
        new Vue({
            el: "#app",
            data: {
                val: ""
            },
            methods: {
                _click(n) {
                    console.log(n);
                },
                yj() {
                    console.log(123);
                },
                _yeye() {
                    console.log("_yeye");
                },
                _parent() {
                    console.log("_parent");
                },
                _child() {
                    console.log("_child");
                },
                _once() {
                    console.log(123);
                },
                _keyup(e) {
                    console.log(e.target.value);
                }
            },
        })
    </script>
</body>

</html>